var rules = {
    "_initState_" : "i",
    "_states_": {
        "i": {
            "_tran_": [
                { "_e_": "d", "_con_": "d", "_target_": "down" },
                { "_e_": "d", "_con_": "lp", "_target_": "waitForLongPress" },
                { "_e_": "d", "_con_": "f", "_target_": "waitForFlick" }
            ]
        },
        "down": {
            "_tran_": [
                { "_con_": "lp", "_target_": "waitForLongPress", "_action_": "startTimer('lp', 1234)|startTimer('d', 1236)" },
                { "_con_": "f", "_target_": "waitForFlick", "_action_": "startTimer('d', 1236)" },
                { "_target_": "exit", "_action_": "fire('d')" }
            ]
        },
        "waitForLongPress": {
            "_tran_": [
                { "_e_": "u", "_target_": "exit", "_action_": "d:fire('d')|u:fire('u')" },
                { "_e_": "dr", "_cond_": "f", "_target_": "waitForFlick" },
                { "_e_": "dr", "_target_": "exit" },
                { "_e_": "lp", "_target_": "exit", "_action_": "fire('lp')" }
            ]
        },
        "waitForFlick": {
            "_tran_": [
                { "_e_": "dr", "_target_": "flick", "_action_": "fire('f')" },
                { "_e_": "u", "_con": "u", "_target_": "exit", "_action_": "fire('u')" },
                { "_e_": "u", "_target_": "exit" }
            ]
        },
        "flick": {
            "_tran_": [
                { "_e_": "dr", "_target_": "flick", "_action_": "fire('f')" },
                { "_e_": "u", "_target_": "inFlick" }
            ],
            "_onEntry_": "cancelAllTimer()"
        },
        "inFlick": {
            "_tran_": [
                { "_e_": "if", "_cond_": "flickSpeed(lessThan(1))", "_target_": "inGravity", "_action_": "cancelTimer('if')" },
                { "_e_": "if", "_target_": "inFlick", "_action_": "fire('if')" }
            ],
            "_onEntry_": "startTimer('if', 50)"
        },
        "inGravity": {
            "_tran_": [
                { "_e_": "if", "_cond_": "reachedGround()", "_target_": "exit" },
                { "_e_": "if", "_target_": "inGravity", "_action_": "fire('ig')" }
            ]
        },
        "exit": {
            "_tran_": [],
            "_onEntry_": "cancelAllTimer()"
        }
    }
};

Event.utils.rules = rules;